import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

enum PortionRaduisType {
  /// 左上 && 右上
  radiusTopLeftAndTopRight,

  /// 左下 && 右下
  radiusBottomLeftAndBottomRight,

  /// 右上 && 右下
  radiusTopRightAndBottomRight,

  /// 左上 && 左下
  raduisTopLeftAndBottomLeft,

  /// 左上 && 左下 && 右上
  raduisTopAndBottomRight,

  /// 右上 && 左下 && 右下
  raduisTopRightAndBottom
}

class RadiusStyle {
  static width(double width) => ScreenUtil().setWidth(width);
  static height(double height) => ScreenUtil().setHeight(height);
  static font(double size) => ScreenUtil().setSp(size);

  static BorderRadius radiusAll(double size) =>
      BorderRadius.all(Radius.circular(width(size)));

  static Border borderAll(double width, Color color) =>
      Border.all(color: color, width: width);

  static setPortionRadius(PortionRaduisType type, double radius) {
    if (type == PortionRaduisType.radiusTopLeftAndTopRight) {
      return BorderRadius.only(
        topLeft: Radius.circular(radius),
        topRight: Radius.circular(radius),
      );
    } else if (type == PortionRaduisType.radiusBottomLeftAndBottomRight) {
      return BorderRadius.only(
        bottomLeft: Radius.circular(radius),
        bottomRight: Radius.circular(radius),
      );
    } else if (type == PortionRaduisType.radiusTopRightAndBottomRight) {
      return BorderRadius.only(
        topRight: Radius.circular(radius),
        bottomRight: Radius.circular(radius),
      );
    } else if (type == PortionRaduisType.raduisTopLeftAndBottomLeft) {
      return BorderRadius.only(
        topLeft: Radius.circular(radius),
        bottomLeft: Radius.circular(radius),
      );
    } else if (type == PortionRaduisType.raduisTopAndBottomRight) {
      return BorderRadius.only(
        topLeft: Radius.circular(radius),
        topRight: Radius.circular(radius),
        bottomRight: Radius.circular(radius),
      );
    } else if (type == PortionRaduisType.raduisTopRightAndBottom) {
      return BorderRadius.only(
        bottomLeft: Radius.circular(radius),
        topRight: Radius.circular(radius),
        bottomRight: Radius.circular(radius),
      );
    }
  }
}
